#include "Square.h"

const int SQUARE_VERTICES = 4;

/*-----------------------------------------------------------------------------------------------*/
Square::Square(const std::string& name) : Shape(name)
{
   m_vertexCount = SQUARE_VERTICES;

   m_pVertices = new ColorVertex[m_vertexCount];

   m_pVertices[0].setVertex(-0.5f,  0.5f, 0.0f, m_color);
   m_pVertices[1].setVertex( 0.5f,  0.5f, 0.0f, m_color);
   m_pVertices[2].setVertex(-0.5f, -0.5f, 0.0f, m_color);
   m_pVertices[3].setVertex( 0.5f, -0.5f, 0.0f, m_color);
}
/*-----------------------------------------------------------------------------------------------*/
void Square::draw(Renderer* renderer)
{
   Shape::draw(renderer);

   if ( isVisible() )
   {
      renderer->DrawElements( 4, m_pVertices, 2, TRIANGLE_STRIP );
   }
}